//
// CompositePicture.java
// ImageGenius
//
// Created by Zhang, Yifan on Jan 19, 2013
// Copyright 2013 Ming Microsystems. All rights reserved.
//

package com.mms.imagegenius.datastructure;

import android.graphics.Bitmap;
import android.graphics.Canvas;

public class CompositePicture {
	private MMSPicture backgroundPicture;
	private MMSPicture foregroundPicture;
	public static final String BUNDLEKEY_STRING = "CompositePicture";

	public CompositePicture (Bitmap backgroundBitmap, Bitmap foregroundBitmap) {
		this(new MMSPicture(backgroundBitmap), new MMSPicture(foregroundBitmap));
	}
	
	public CompositePicture (MMSPicture backgroundPicture, MMSPicture foregroundPicture) {
		this.backgroundPicture = backgroundPicture;
		this.foregroundPicture = foregroundPicture;
	}
	
	public Bitmap getOverlayedPicture() {
		Bitmap overlayedBitmap = Bitmap.createBitmap(backgroundPicture.getBitmap().getWidth(), backgroundPicture.getBitmap().getHeight(), Bitmap.Config.ARGB_8888);
		Canvas canvas = new Canvas(overlayedBitmap);

		canvas.drawBitmap(backgroundPicture.getTransformedBitmap(), 0, 0, null);
		canvas.drawBitmap(foregroundPicture.getTransformedBitmap(), 0, 0, null);

		return overlayedBitmap;
	}

}
